#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 3e4 + 10;

int w, n, a[N];

int main()
{
	cin >> w >> n;
	for(int i = 1;i <= n;i ++) cin >> a[i];
	sort(a + 1, a + 1 + n);
	int l = 1, r = n, ans = 0;
	while(l <= r)
	{
		if(a[l] + a[r] > w) r --;
		else l ++, r --;
		ans ++;
	}
	cout << ans << endl;
	return 0;
}